home *** CD-ROM | disk | FTP | other *** search
/ CD School House 9 / CD School House 9.0 - Wayzata Technology (1994).iso / pc / dos / math / ode25 / duffing.ode < prev    next >
Text File  |  1994-03-03  |  378b  |  22 lines

  1. # DUFFING.ODE
  2. # Duffing oscillator
  3. # A driven nonlinear oscillator with chaotic solutions.
  4. # Try plotting v against x.
  5.  
  6. # Use 5th order Runge-Kutta, fixed step size, 100 steps
  7. $m -5
  8. $n 200
  9. $g d
  10.  
  11. # Solve to 100
  12. $t 200
  13.  
  14. x  = 1
  15. v  = 0
  16. t  = 0
  17. a  = 0.3      #  a is drive amplitude
  18. twopi = pi(2)
  19. x' = v/twopi
  20. v' = (-cub(x) + x - 0.25*v + a*cos(t))/twopi
  21. t' = 1
  22.